﻿Public Class FrmRegistrarCliente

    Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
        frmTransparente.Close()
    End Sub

    Private Sub picAtras_Click(sender As Object, e As EventArgs) Handles picAtras.Click
        frmTransparente.Close()
    End Sub

    Private Sub FrmRegistrarCliente_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Pa_consultar_tipos_identificacionTableAdapter.Fill(GetFitDataSet.pa_consultar_tipos_identificacion)
        Pa_consultar_tipos_generoTableAdapter.Fill(GetFitDataSet.pa_consultar_tipos_genero)
        Pa_consultar_tipos_objetivosTableAdapter.Fill(GetFitDataSet.pa_consultar_tipos_objetivos)

        cbxRol.DataSource = objGestor.listarRoles()
        cbxRol.DisplayMember = "Nombre"
        cbxRol.ValueMember = "Id"

        If Screen.PrimaryScreen.WorkingArea.Height < 900 Then
            Me.AutoScroll = True
        End If

    End Sub

    Private Sub btnSiguiente_Click(sender As Object, e As EventArgs) Handles btnSiguiente.Click

        lblNombreReq.Visible = False
        lblApellidoReq.Visible = False
        lblIdentificacionReq.Visible = False
        lblCorreoReq.Visible = False
        lblNacionalidadReq.Visible = False
        lblAliasReq.Visible = False
        lblTelefonoReq.Visible = False

        Dim requeridos As New List(Of TextBox)
        requeridos.Add(txtPrimerNombre)
        requeridos.Add(txtPrimerApellido)
        requeridos.Add(txtIdentificacion)
        requeridos.Add(txtNacionalidad)
        requeridos.Add(txtCorreoElectronico)
        requeridos.Add(txtAlias)
        requeridos.Add(txtTelefono)

        For Each txtBox As TextBox In requeridos
            If txtBox.Text = "" Then
                Select Case txtBox.Name
                    Case "txtPrimerNombre"
                        lblNombreReq.Visible = True
                    Case "txtPrimerApellido"
                        lblApellidoReq.Visible = True
                    Case "txtIdentificacion"
                        lblIdentificacionReq.Visible = True
                    Case "txtCorreoElectronico"
                        lblCorreoReq.Visible = True
                    Case "txtNacionalidad"
                        lblNacionalidadReq.Visible = True
                    Case "txtAlias"
                        lblAliasReq.Visible = True
                    Case "txtTelefono"
                        lblTelefonoReq.Visible = True
                End Select
            End If
        Next

        If txtPrimerNombre.Text <> "" And txtPrimerApellido.Text <> "" And txtIdentificacion.Text <> "" And txtNacionalidad.Text <> "" And 
            txtCorreoElectronico.Text <> "" And txtAlias.Text <> "" Then
            Dim entro As Boolean = False
            For Each x As Control In Me.Parent.Controls.OfType(Of FrmRegistrarCredencialesCliente)()
                x.Visible = True
                entro = True
            Next
            If Not entro Then
                Dim frm As New FrmRegistrarCredencialesCliente()
                frm.Dock = DockStyle.Fill
                Me.Parent.Controls.Add(frm)
            End If
            Me.Visible = False
        End If

    End Sub

    Private Sub cbxTipoIdentificacion_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub
End Class
